Skip to content

Correct doc comments that describe the wrong behavior - #294

Merged
LinuxJedi merged 1 commit into
wolfSSL:masterfrom
Frauschi:doc-comment-fixes
Nov 10, 2026
Merged

LinuxJedi merged 1 commit into
wolfSSL:masterfrom
Frauschi:doc-comment-fixes

Conversation

@Frauschi

@Frauschi Frauschi commented Nov 9, 2026

Copy link
Copy Markdown
Member

Corrects API doc comments that describe behavior the code does not have, from eight Fenrir findings. Comments only; no code changes.

Changes

  • C_Finalize: pReserved is an input that must be NULL; lists CKR_CRYPTOKI_NOT_INITIALIZED and CKR_ARGUMENTS_BAD
  • C_SetOperationState: replaces the session's operation with the saved digest state (was described as a getter); key handles must be CK_INVALID_HANDLE
  • Digest functions: drop the claim that no digest mechanism is supported; pDigest is an output
  • C_UnwrapKey: lists the supported mechanisms and key types, names ulWrappedKeyLen and documents the argument and wrapped-key errors
  • WP11_Slot_TokenFailedExpire: returns a time, not a failed-login count
  • WP11_Session_IsRW, WP11_Session_IsOpInitialized, WP11_Session_IsHashOpInitialized: return descriptions match the predicates
  • WP11_Object_SetSecretKey: sets secret key data, not DH key data
  • WP11_TOKEN_STATE_*: labeled as token initialization state

Fixes F-15388, F-15389, F-15390, F-15391, F-15392, F-15393, F-15394, F-15395.

- C_Finalize: pReserved is an input that must be NULL, not an ignored
  output; list CKR_CRYPTOKI_NOT_INITIALIZED and CKR_ARGUMENTS_BAD.
- C_SetOperationState replaces the session's operation with the saved
  digest state; it was described as a getter.
- The digest functions no longer claim that no digest mechanism is
  supported, and pDigest is an output.
- C_UnwrapKey lists the mechanisms and key types it supports, names
  ulWrappedKeyLen correctly and documents the argument and wrapped-key
  errors.
- WP11_Slot_TokenFailedExpire returns the last failed login time plus
  the lockout timeout, not a count of failed logins.
- WP11_Session_IsRW reports a read/write session, not one in use, and
  WP11_Session_IsOpInitialized and WP11_Session_IsHashOpInitialized had
  the same copied text.
- WP11_Object_SetSecretKey sets secret key data, not DH key data.
- The WP11_TOKEN_STATE_* macros carried the session access-mode comment.

Fixes F-15388.
Fixes F-15389.
Fixes F-15390.
Fixes F-15391.
Fixes F-15392.
Fixes F-15393.
Fixes F-15394.
Fixes F-15395.
Copilot AI balanced review requested due to automatic review settings November 9, 2026 22:25
@Frauschi Frauschi self-assigned this Nov 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the documentation-only corrections.

No open issues 🎉

What changed in this PR

This PR corrects API documentation to match existing PKCS#11 behavior and internal helper functions. All changes are comments only; runtime behavior is unchanged.

Changes:

  • Clarifies finalization and operation-state restoration requirements and return values.
  • Corrects digest output parameters and documents supported key-unwrapping behavior.
  • Fixes internal descriptions of token state, session predicates, lockout expiry, and secret-key data.
File Description
wolfpkcs11/​internal.h Labels token initialization state constants correctly.
src/​wolfpkcs11.c Clarifies C_Finalize input requirements and errors.
src/​slot.c Documents digest-state restoration and required invalid key handles.
src/​internal.c Corrects helper descriptions and return-value documentation.
src/​crypto.c Updates digest and key-unwrapping documentation.

Review effort: Balanced

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #294

Scan targets checked: wolfpkcs11-src, wolfpkcs11-bugs
Coverage: 5 of 5 in-scope changed file(s) opened by the reviewer

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Max

@Frauschi Frauschi assigned wolfSSL-Bot and unassigned Frauschi Nov 10, 2026
@Frauschi
Frauschi requested a review from LinuxJedi November 10, 2026 09:17
@LinuxJedi
LinuxJedi merged commit e595d83 into wolfSSL:master Nov 10, 2026
103 checks passed
@Frauschi
Frauschi deleted the doc-comment-fixes branch November 10, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants